import {
  uniqueId
} from 'lodash'
/**
 * @description 给菜单数据补充上 path 字段
 * @description https://github.com/d2-projects/d2-admin/issues/209
 * @param {Array} menu 原始的菜单数据
 */
function supplementPath(menu) {
  return menu.map(e => ({
    ...e,
    path: e.path || uniqueId('d2-menu-empty-'),
    ...e.children ? {
      children: supplementPath(e.children)
    } : {}
  }))
}

export const menuHeader = [{
  path: '/index',
  title: '首页',
  icon: 'profile',
  name: 'index'
},
{
  path: '/setting',
  title: '系统设置',
  icon: 'solution',
  name: 'setting'
},
]

export const menuAside = supplementPath([
  {
    path: '/setting',
    title: '系统设置',
    icon: 'pie-chart',
    name: 'setting',
    children: [{
      path: '/role',
      title: '角色管理',
      name: 'role',

    }, {
      path: '/member',
      title: '成员管理',
      name: 'member',

    },]
  },

])